// preload.js
window.addEventListener('DOMContentLoaded', () => {
  const replaceText = (selector, text) => {
    const element = document.getElementById(selector)
    if (element) element.innerText = text
  }

  for (const type of ['chrome', 'node', 'electron']) {
    replaceText(`${type}-version`, process.versions[type])
  }

  // 禁用 WebGL
  // try {
  //   const canvas = document.createElement('canvas')
  //   const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl')
  //   if (gl) {
  //     const loseContext = gl.getExtension('WEBGL_lose_context')
  //     if (loseContext) {
  //       loseContext.loseContext()
  //     }
  //   }
  // } catch (e) {
  //   console.warn('WebGL context not available:', e)
  // }

  // 禁用 WebGL
  try {
    const canvas = document.createElement('canvas')
    canvas.getContext = () => {
      return null
    }
  } catch (e) {
    console.warn('Failed to override WebGL context:', e)
  }
})
